import instance from "./utils/http";

export function getLoop(number) {
    return instance.get(`/api/weChat/applet/course/banner/list?number=${number}`)
}

export function getList(type) {
    let params = new URLSearchParams
    params.append("type", type)
    params.append("pageNum", 2)
    params.append("pageSize", 5)
    return instance.post(`/api/weChat/applet/course/list/type`, params)
}
export function getDetail(data = {}){
    return instance.post(`/api/weChat/applet/subject/list`,data);
}


export function getCourseDetail(courseId) {
    return instance.get(`/api/pc/course/detail/${courseId}`);
  }
  export function searchCourses(
    keyword = '', 
    type = '',  
    subjectId="",
    method = "",
    pageNum = 1, 
    pageSize = 15
  ) {
    return instance.get('/api/pc/course/search/keyword', {
      params: {
        keyword,
        type,
        subjectId,
        method, 
        pageNum,
        pageSize
      }
    });
  }

  export function getLogin(username, password) {
    let params = new URLSearchParams
    params.append("username", username)
    params.append("password", password)
    params.append("rememberMe", "false")
    return instance.post(`/api/pcUser/login`, params)
}

export function getZidian(blogroll,dictSort = '', asc = '') {
  let params = new URLSearchParams
  params.append("dictType", blogroll)
  params.append("pageNum", 1)
  params.append("pageSize", 10)
  params.append("orderByColumn",dictSort)
  params.append("isAsc", asc)
  return instance.post(`/api//system/dict/data/list/open`, params)
}